package com.lcredu.service.impl;

import com.lcredu.dao.MemberDAO;
import com.lcredu.dao.impl.MemberDAOImpl;
import com.lcredu.entity.Member;
import com.lcredu.service.MemberService;

/**
 * @author 黎长容
 * @date 2025-07-05 16:23
 */
public class MemberServiceImpl implements MemberService {
    private MemberDAO memberDAO = new MemberDAOImpl();

    /**
     * 查询用户是否存在...
     *
     * @param name 用户名
     */
    @Override
    public boolean getMemberByName(String name) {
        Member memberByName = memberDAO.getMemberByName(name);
        return memberByName == null ? true : false;
    }

    @Override
    public boolean savMember(Member member) {
        return memberDAO.savaMember(member) == 1 ? true : false;
    }

    @Override
    public Member login(Member member) {
        return memberDAO.getMemberByNameAndPwd(member);
    }
}
